//@author A0094511L Lu Si Hong
///@class OutputManager
///@Description This class converts the structure received from EntriesManager into properly formatted strings for
//				the GUI to make use of. The strings are formatted through the addition of HTML tags, and returned 
//				as a concatenated strings of html string that can be recognized by GUI.

#pragma once
#include <QString>
#include "CommonUtils.h"
#include <vector>
#include <cassert>

class OutputManager
{
public:
	OutputManager(vector <vector<CommonUtils::ReturnString>> outputFromManager);
	~OutputManager(void);

	static const QString SECTION_HEADER_TITLE_FRONT_TAG;
	static const QString SECTION_HEADER_TITLE_BACK_TAG;
	static const QString SECTION_HEADER_DATE_FRONT_TAG;
	static const QString SECTION_HEADER_DATE_BACK_TAG;
	static const QString SECTION_HEADER_ONLYONE_BACK_TAG;

	static const QString SECTION_COMPONENT_NAME_FRONT_TAG_NORMAL;
	static const QString SECTION_COMPONENT_NAME_BACK_TAG_NORMAL;
	static const QString SECTION_COMPONENT_DATEORTIME_FRONT_TAG_NORMAL;
	static const QString SECTION_COMPONENT_DATEORTIME_END_TAG_NORMAL;
	static const QString SECTION_COMPONENT_ONLYONE_BACK_TAG_NORMAL;

	static const QString SECTION_COMPONENT_NAME_FRONT_TAG_ADDITION;
	static const QString SECTION_COMPONENT_NAME_BACK_TAG_ADDITION;
	static const QString SECTION_COMPONENT_DATEORTIME_FRONT_TAG_ADDITION;
	static const QString SECTION_COMPONENT_DATEORTIME_END_TAG_ADDITION;
	static const QString SECTION_COMPONENT_ONLYONE_BACK_TAG_ADDITION;

	static const QString SECTION_COMPONENT_NAME_FRONT_TAG_CLASH;
	static const QString SECTION_COMPONENT_NAME_BACK_TAG_CLASH;
	static const QString SECTION_COMPONENT_DATEORTIME_FRONT_TAG_CLASH;
	static const QString SECTION_COMPONENT_DATEORTIME_END_TAG_CLASH;
	static const QString SECTION_COMPONENT_ONLYONE_BACK_TAG_CLASH;

	static const QString SECTION_COMPONENT_NAME_FRONT_TAG_DONE;
	static const QString SECTION_COMPONENT_NAME_BACK_TAG_DONE;
	static const QString SECTION_COMPONENT_DATEORTIME_FRONT_TAG_DONE;
	static const QString SECTION_COMPONENT_DATEORTIME_END_TAG_DONE;
	static const QString SECTION_COMPONENT_ONLYONE_BACK_TAG_DONE;
	//accessor function for formatted string
	QString getFormattedString();

private:

	vector<vector<CommonUtils::ReturnString>> _vectOfVectOfStrings;
	QString _formattedOutput;

	//Function adds HTML tags to section headers, for example, today, tmr, future, overdue.
	QString appendSectionHeaderTags(pair<string, string>);

	//Function adds HTML tags to normal entries
	QString appendNormalComponentTags(pair<string, string>);

	//Function adds HTML tags to newly added entries
	QString appendAdditionComponentTags(pair<string, string>);

	//Function adds HTML tags to clashing entries
	QString appendClashComponentTags(pair<string, string>);

	//Function adds HTML tags to completed entries
	QString appendDoneComponentTags(pair<string, string>);
	//Function converts the vector of vector of pair of strings to the correct format
	void convertToOutputStr();

	//Function converts the vector of each section to a formatted string
	QString convertEachSectionToStr(vector<CommonUtils::ReturnString> section);

	//Function append tags individually for each data point according to its type
	QString appendTagsForEachData(CommonUtils::ReturnString data);

};
